package api

import (
	"360-cinema/api-getaway/basic/config"
	"360-cinema/api-getaway/basic/handler/request"
	__ "360-cinema/api-getaway/basic/videoProto"
	"github.com/gin-gonic/gin"
	"net/http"
)

func ListDrama(c *gin.Context) {

	var drama request.ListDrama
	err := c.ShouldBind(&drama)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 0,
			"msg":  "参数错误",
		})
		return
	}
	r, err := config.VideoClient.ListDrama(c, &__.ListDramaReq{
		VideoId: int64(drama.VideoId),
	})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 0,
			"msg":  "查询失败",
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"VideoId":  r.VideoId,
		"Num":      r.Num,
		"Title":    r.Title,
		"Duration": r.Duration,
		"FileUrl":  r.FileUrl,
		"PlayTime": r.PlayTime,
	})
}
